import java.net.*;

public class CheckConnection {
    public static void main(String[] args) {
		//注意修改为个人需要测试的IP和端口
        String ipAddress = "10.181.18.55";
        int port = 6379;
        
        try {
            Socket socket = new Socket();
            socket.connect(new InetSocketAddress(ipAddress, port), 2000); // 连接超时设置为 2 秒
            
            System.out.println("Connection to " + ipAddress + " on port " + port + " successful");
            socket.close();
        } catch (Exception e) {
            System.out.println("Connection to " + ipAddress + " on port " + port + " failed: " + e.getMessage());
        }
    }
}